<?
/*-- Project Introduce --*/


/**
 * What's this Class ?
 *
 * @author		alee
 * @access		public
 */
class JJ_Setting extends JCAT_FSPreference
{
	/**
	 * 构造函数
	 *
	 * @access	protected
	 * @return	void
	 */
	protected function JJ_Setting()
	{
		$this->JCAT_FSPreference(JJ_SETTING_ROOTPATH) ;
	}
	
	/**
	 * 取得单件
	 *
	 * @access	public
	 * @static
	 * @return	JJ_Setting
	 */
	static public function GetGlobalInstance()
	{
		if( !self::$aInstance )
		{
			self::$aInstance = new JJ_Setting() ;
		}
		
		return self::$aInstance ;
	}
	
	/**
	 * 恢复默认设置
	 *
	 * @access	public
	 * @static
	 * @return	void
	 */
	static public function RestoreDefault()
	{
		$aSetting = JJ_Setting::GetGlobalInstance() ;
		$aSetting->CreateKey('/Jabber') ;
		$aSetting->SetItem('/Jabber','ServerHost','jabber.org') ;
		$aSetting->SetItem('/Jabber','ServerPort',5222) ;
		$aSetting->SetItem('/Jabber','LoginTimeout',15) ;
		$aSetting->SetItem('/Jabber','JabberIDPrefix','family.') ;
		$aSetting->SetItem('/Jabber','JabberIDPostfix','#alee2002.com') ;
		
		$aSetting->CreateKey('/JJ') ;
		$aSetting->SetItem('/JJ','ClientResourceName','JeCat-Jabber') ;
		$aSetting->SetItem('/JJ','ClientVersion','0.1') ;
		$aSetting->CreateKey('/JJ/Login') ;
		
		$aSetting->SetItem('/JJ','ProductName',JCAT_Language::Sentence('JeCat Jabber PHP开源即时通讯')) ;
	}
	
	/**
	 * 单件对象
	 * 
	 * @access	private
	 * @static
	 * @var		JJ_Setting
	 */
	static private $aInstance ;
}

?>